<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin:0;
            padding: 0;
        }
        html,body,#root{
            width: 100%;
            height: 100%;
            overflow:hidden;
        }
    </style>
</head>
<body>
    <div id="root">
        <h2>阻止默认行为</h2>
        <h3>后遗症</h3>
        <a href="http://atguigu.com">尚硅谷</a>

        <p>阳光灼热，数不尽夏日繁华；蝉鸣幽幽，道不完苦辣酸甜
            阳光灼热，数不尽夏日繁华；蝉鸣幽幽，道不完苦辣酸甜
            阳光灼热，数不尽夏日繁华；蝉鸣幽幽，道不完苦辣酸甜
        </p>
    </div>

    <script>
        //获取 root 元素
        let root = document.querySelector("#root");

        root.addEventListener("touchstart", function(e) {
            //阻止默认行为
            e.preventDefault();
        });

        //获取 a 元素
        let a = document.querySelector("a");
        let p = document.querySelector("p");
        a.addEventListener("touchstart", function(e){
            //阻止冒泡  灵丹妙药
            e.stopPropagation();
        });

        p.addEventListener('touchstart', function(e){
            e.stopPropagation();
        })

    </script>
</body>
</html>